
/*
 * Copyright 2002-2023 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 *版权所有2002-2023原作者。
 *
 *根据Apache许可证2.0版（“许可证”）获得许可；
 *除非符合许可证，否则不得使用此文件。
 *您可以在以下地址获取许可证副本：
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 *除非适用法律要求或书面同意，软件
 *根据许可证分发的内容是按“原样”分发的，
 *无任何明示或暗示的保证或条件。
 *有关管理权限和
 *许可证下的限制。
 */

package org.springframework.beans.factory.config;

import java.util.Set;

import org.springframework.beans.BeansException;
import org.springframework.beans.TypeConverter;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.NoUniqueBeanDefinitionException;
import org.springframework.lang.Nullable;

/**
 * Extension of the {@link org.springframework.beans.factory.BeanFactory}
 * interface to be implemented by bean factories that are capable of
 * autowiring, provided that they want to expose this functionality for
 * existing bean instances.
 *
 * <p>This subinterface of BeanFactory is not meant to be used in normal
 * application code: stick to {@link org.springframework.beans.factory.BeanFactory}
 * or {@link org.springframework.beans.factory.ListableBeanFactory} for
 * typical use cases.
 *
 * <p>Integration code for other frameworks can leverage this interface to
 * wire and populate existing bean instances that Spring does not control
 * the lifecycle of. This is particularly useful for WebWork Actions and
 * Tapestry Page objects, for example.
 *
 * <p>Note that this interface is not implemented by
 * {@link org.springframework.context.ApplicationContext} facades,
 * as it is hardly ever used by application code. That said, it is available
 * from an application context too, accessible through ApplicationContext's
 * {@link org.springframework.context.ApplicationContext#getAutowireCapableBeanFactory()}
 * method.
 *
 * <p>You may also implement the {@link org.springframework.beans.factory.BeanFactoryAware}
 * interface, which exposes the internal BeanFactory even when running in an
 * ApplicationContext, to get access to an AutowireCapableBeanFactory:
 * simply cast the passed-in BeanFactory to AutowireCapableBeanFactory.
 *
 * @author Juergen Hoeller
 * @since 04.12.2003
 * @see org.springframework.beans.factory.BeanFactoryAware
 * @see org.springframework.beans.factory.config.ConfigurableListableBeanFactory
 * @see org.springframework.context.ApplicationContext#getAutowireCapableBeanFactory()
 */
/**
 *｛@link.org.springframework.beans.factory.BeanFactory｝的扩展
 *接口由能够
 *自动布线，前提是他们希望为
 *现有bean实例。
 *
 *＜p＞BeanFactory的这个子接口不打算在正常情况下使用
 *应用程序代码：坚持{@link.org.springframework.beans.factory.BeanFactory}
 *或｛@link.org.springframework.beans.factory.ListableBeanFactory｝
 *典型用例。
 *
 *＜p＞其他框架的集成代码可以利用此接口
 *连接并填充Spring无法控制的现有bean实例
 *的生命周期。这对于WebWork操作和
 *例如，TapestryPage对象。
 *
 *＜p＞请注意，此接口不是由
 *{@link.org.springframework.context.ApplicationContext}立面，
 *因为它几乎从未被应用程序代码使用。也就是说，它是可用的
 *也可以通过ApplicationContext的
 *｛@link org.springframework.context.ApplicationContext#getAutowireCapableBeanFactory（）｝
 *方法。
 *
 *＜p＞您还可以实现｛@link org.springframework.beans.factory.BeanFactoryAware｝
 *接口，即使在
 *ApplicationContext，以访问AutowireCapableBeanFactory：
 *只需将传入的BeanFactory强制转换为AutowireCapableBeanFactory。
 *
 *@作者Juergen Hoeller
 *@自2003年12月4日
 *@参见org.springframework.beans.factory.BeanFactory软件
 *@参见org.springframework.beans.factory.config.ConfigurableListableBeanFactory
 *@see org.springframework.context.ApplicationContext#getAutowireCapableBeanFactory（）
 */
public interface AutowireCapableBeanFactory extends BeanFactory {

	/**
	 * Constant that indicates no externally defined autowiring. Note that
	 * BeanFactoryAware etc and annotation-driven injection will still be applied.
	 * @see #createBean
	 * @see #autowire
	 * @see #autowireBeanProperties
	 */
	/**
	 *常量，表示没有外部定义的自动布线。请注意
	 *BeanFactoryAware等和注释驱动的注入仍将应用。
	 *@参见#createBean
	 *@参见#autowire
	 *@参见#autowireBeanProperties
	 */
	int AUTOWIRE_NO = 0;

	/**
	 * Constant that indicates autowiring bean properties by name
	 * (applying to all bean property setters).
	 * @see #createBean
	 * @see #autowire
	 * @see #autowireBeanProperties
	 */
	/**
	 *按名称指示自动连接bean财产的常量
	 *（适用于所有bean属性设置器）。
	 *@参见#createBean
	 *@参见#autowire
	 *@参见#autowireBeanProperties
	 */
	int AUTOWIRE_BY_NAME = 1;

	/**
	 * Constant that indicates autowiring bean properties by type
	 * (applying to all bean property setters).
	 * @see #createBean
	 * @see #autowire
	 * @see #autowireBeanProperties
	 */
	/**
	 *指示按类型自动连接bean财产的常量
	 *（适用于所有bean属性设置器）。
	 *@参见#createBean
	 *@参见#autowire
	 *@参见#autowireBeanProperties
	 */
	int AUTOWIRE_BY_TYPE = 2;

	/**
	 * Constant that indicates autowiring the greediest constructor that
	 * can be satisfied (involves resolving the appropriate constructor).
	 * @see #createBean
	 * @see #autowire
	 */
	/**
	 *常量，指示自动连接最贪婪的构造函数
	 *可以满足（包括解析适当的构造函数）。
	 *@参见#createBean
	 *@参见#autowire
	 */
	int AUTOWIRE_CONSTRUCTOR = 3;

	/**
	 * Constant that indicates determining an appropriate autowire strategy
	 * through introspection of the bean class.
	 * @see #createBean
	 * @see #autowire
	 * @deprecated as of Spring 3.0: If you are using mixed autowiring strategies,
	 * prefer annotation-based autowiring for clearer demarcation of autowiring needs.
	 */
	/**
	 *指示确定适当自动连线策略的常量
	 *通过bean类的内省。
	 *@参见#createBean
	 *@参见#autowire
	 *@自Spring 3.0起已弃用：如果您使用混合自动布线策略，
	 *更喜欢基于注释的自动布线，以便更清晰地划分自动布线需求。
	 */
	@Deprecated
	int AUTOWIRE_AUTODETECT = 4;

	/**
	 * Suffix for the "original instance" convention when initializing an existing
	 * bean instance: to be appended to the fully-qualified bean class name,
	 * e.g. "com.mypackage.MyClass.ORIGINAL", in order to enforce the given instance
	 * to be returned, i.e. no proxies etc.
	 * @since 5.1
	 * @see #initializeBean(Object, String)
	 * @see #applyBeanPostProcessorsBeforeInitialization(Object, String)
	 * @see #applyBeanPostProcessorsAfterInitialization(Object, String)
	 */
	/**
	 *初始化现有实例时“原始实例”约定的后缀
	 *bean实例：附加到完全限定的bean类名，
	 *例如“com.mypackage.MyClass.ORIGINAL”，以便强制执行给定的实例
	 *即没有代理等。
	 *@自5.1
	 *@see#initializeBean（对象，字符串）
	 *@参见#applyBeanPostProcessorBeforeInitialization（对象，字符串）
	 *@参见#applyBeanPostProcessorAfterInitialization（对象，字符串）
	 */
	String ORIGINAL_INSTANCE_SUFFIX = ".ORIGINAL";


	//-------------------------------------------------------------------------
	// -------------------------------------------------------------------------
	// Typical methods for creating and populating external bean instances
	// 创建和填充外部bean实例的典型方法
	//-------------------------------------------------------------------------
	// -------------------------------------------------------------------------

	/**
	 * Fully create a new bean instance of the given class.
	 * <p>Performs full initialization of the bean, including all applicable
	 * {@link BeanPostProcessor BeanPostProcessors}.
	 * <p>Note: This is intended for creating a fresh instance, populating annotated
	 * fields and methods as well as applying all standard bean initialization callbacks.
	 * Constructor resolution is done via {@link #AUTOWIRE_CONSTRUCTOR}, also influenced
	 * by {@link SmartInstantiationAwareBeanPostProcessor#determineCandidateConstructors}.
	 * It does <i>not</i> imply traditional by-name or by-type autowiring of properties;
	 * use {@link #createBean(Class, int, boolean)} for those purposes.
	 * @param beanClass the class of the bean to create
	 * @return the new bean instance
	 * @throws BeansException if instantiation or wiring failed
	 */
	/**
	 *完全创建给定类的新bean实例。
	 *＜p＞执行bean的完全初始化，包括所有适用的
	 *｛@link BeanPostProcessor BeanPostProcessors｝。
	 *＜p＞注意：这是为了创建一个新的实例，填充注释
	 *字段和方法，以及应用所有标准bean初始化回调。
	 *构造函数解析是通过｛@link#AUTOWIRE_Constructor｝完成的
	 *通过｛@link SmartInstantiationAwareBeanPostProcessor#determineCandidateConstructors｝。
	 *它确实不意味着财产的传统旁路或旁路自动布线；
	 *为此，请使用{@link#createBean（Class，int，boolean）}。
	 *@param beanClass要创建的bean的类
	 *@return新的bean实例
	 *如果实例化或连接失败，@throws BeansException
	 */
	<T> T createBean(Class<T> beanClass) throws BeansException;

	/**
	 * Populate the given bean instance through applying after-instantiation callbacks
	 * and bean property post-processing (e.g. for annotation-driven injection).
	 * <p>Note: This is essentially intended for (re-)populating annotated fields and
	 * methods, either for new instances or for deserialized instances. It does
	 * <i>not</i> imply traditional by-name or by-type autowiring of properties;
	 * use {@link #autowireBeanProperties} for those purposes.
	 * @param existingBean the existing bean instance
	 * @throws BeansException if wiring failed
	 */
	/**
	 *通过实例化后应用回调填充给定的bean实例
	 *以及bean属性后处理（例如用于注释驱动的注入）。
	 *＜p＞注意：这主要是为了（重新）填充带注释的字段和
	 *方法，用于新实例或反序列化实例。确实如此
	 *<i>不</i>表示财产的传统旁路或旁路自动布线；
	 *为此，请使用｛@link#autowireBeanProperties｝。
	 *@param existingBean现有bean实例
	 *如果连线失败，@throws BeansException
	 */
	void autowireBean(Object existingBean) throws BeansException;

	/**
	 * Configure the given raw bean: autowiring bean properties, applying
	 * bean property values, applying factory callbacks such as {@code setBeanName}
	 * and {@code setBeanFactory}, and also applying all bean post processors
	 * (including ones which might wrap the given raw bean).
	 * <p>This is effectively a superset of what {@link #initializeBean} provides,
	 * fully applying the configuration specified by the corresponding bean definition.
	 * <b>Note: This method requires a bean definition for the given name!</b>
	 * @param existingBean the existing bean instance
	 * @param beanName the name of the bean, to be passed to it if necessary
	 * (a bean definition of that name has to be available)
	 * @return the bean instance to use, either the original or a wrapped one
	 * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException
	 * if there is no bean definition with the given name
	 * @throws BeansException if the initialization failed
	 * @see #initializeBean
	 */
	/**
	 *配置给定的原始bean：自动连接bean财产，应用
	 *bean属性值，应用工厂回调，例如｛@code setBeanName｝
	 *和｛@code setBeanFactory｝，并应用所有bean后处理器
	 *（包括可能包裹给定生豆的那些）。
	 *＜p＞这实际上是｛@link#initializeBean｝提供的超集，
	 *完全应用相应bean定义指定的配置。
	 *<b>注意：此方法需要给定名称的bean定义</b>
	 *@param existingBean现有bean实例
	 *@param beanName bean的名称，如果需要，将传递给它
	 *（该名称的bean定义必须可用）
	 *@返回要使用的bean实例，无论是原始实例还是包装的实例
	 *@throws org.springframework.beans.factory.NoSuchBeanDefinitionException
	 *如果没有具有给定名称的bean定义
	 *如果初始化失败，@throws BeansException
	 *@参见#initializeBean
	 */
	Object configureBean(Object existingBean, String beanName) throws BeansException;


	//-------------------------------------------------------------------------
	// -------------------------------------------------------------------------
	// Specialized methods for fine-grained control over the bean lifecycle
	// 用于对bean生命周期进行细粒度控制的专用方法
	//-------------------------------------------------------------------------
	// -------------------------------------------------------------------------

	/**
	 * Fully create a new bean instance of the given class with the specified
	 * autowire strategy. All constants defined in this interface are supported here.
	 * <p>Performs full initialization of the bean, including all applicable
	 * {@link BeanPostProcessor BeanPostProcessors}. This is effectively a superset
	 * of what {@link #autowire} provides, adding {@link #initializeBean} behavior.
	 * @param beanClass the class of the bean to create
	 * @param autowireMode by name or type, using the constants in this interface
	 * @param dependencyCheck whether to perform a dependency check for objects
	 * (not applicable to autowiring a constructor, thus ignored there)
	 * @return the new bean instance
	 * @throws BeansException if instantiation or wiring failed
	 * @see #AUTOWIRE_NO
	 * @see #AUTOWIRE_BY_NAME
	 * @see #AUTOWIRE_BY_TYPE
	 * @see #AUTOWIRE_CONSTRUCTOR
	 */
	/**
	 *使用指定的
	 *自动连线策略。此处支持在此接口中定义的所有常量。
	 *＜p＞执行bean的完全初始化，包括所有适用的
	 *｛@link BeanPostProcessor BeanPostProcessors｝。这实际上是一个超集
	 *｛@link#autowire｝提供的功能，添加了｛@link#initializeBean｝行为。
	 *@param beanClass要创建的bean的类
	 *@param autowireMode（按名称或类型），使用此接口中的常量
	 *@param dependencyCheck是否对对象执行依赖性检查
	 *（不适用于自动连接构造函数，因此在那里被忽略）
	 *@return新的bean实例
	 *如果实例化或连接失败，@throws BeansException
	 *@参见#AUTOWIRE_NO
	 *@参见#AUTOWIRE_BY_NAME
	 *@参见#AUTOWIRE_BY_TYPE
	 *@参见#AUTOWIRE_CCONSTRUCTOR
	 */
	Object createBean(Class<?> beanClass, int autowireMode, boolean dependencyCheck) throws BeansException;

	/**
	 * Instantiate a new bean instance of the given class with the specified autowire
	 * strategy. All constants defined in this interface are supported here.
	 * Can also be invoked with {@code AUTOWIRE_NO} in order to just apply
	 * before-instantiation callbacks (e.g. for annotation-driven injection).
	 * <p>Does <i>not</i> apply standard {@link BeanPostProcessor BeanPostProcessors}
	 * callbacks or perform any further initialization of the bean. This interface
	 * offers distinct, fine-grained operations for those purposes, for example
	 * {@link #initializeBean}. However, {@link InstantiationAwareBeanPostProcessor}
	 * callbacks are applied, if applicable to the construction of the instance.
	 * @param beanClass the class of the bean to instantiate
	 * @param autowireMode by name or type, using the constants in this interface
	 * @param dependencyCheck whether to perform a dependency check for object
	 * references in the bean instance (not applicable to autowiring a constructor,
	 * thus ignored there)
	 * @return the new bean instance
	 * @throws BeansException if instantiation or wiring failed
	 * @see #AUTOWIRE_NO
	 * @see #AUTOWIRE_BY_NAME
	 * @see #AUTOWIRE_BY_TYPE
	 * @see #AUTOWIRE_CONSTRUCTOR
	 * @see #AUTOWIRE_AUTODETECT
	 * @see #initializeBean
	 * @see #applyBeanPostProcessorsBeforeInitialization
	 * @see #applyBeanPostProcessorsAfterInitialization
	 */
	/**
	 *使用指定的autowire实例化给定类的新bean实例
	 *战略。此处支持在此接口中定义的所有常量。
	 *也可以使用｛@code AUTOWIRE_NO｝调用，以便仅应用
	 *在实例化回调之前（例如用于注释驱动的注入）。
	 *＜p＞＜i＞是否＜/i＞应用标准｛@link BeanPostProcessor BeanPostProcessors｝
	 *回调或执行bean的任何进一步初始化。此接口
	 *例如，为这些目的提供了不同的细粒度操作
	 *｛@link#initializeBean｝。然而，｛@link InstantiationAwareBeanPostProcessor｝
	 *如果适用于实例的构造，则应用回调。
	 *@param beanClass要实例化的bean的类
	 *@param autowireMode（按名称或类型），使用此接口中的常量
	 *@param dependencyCheck是否对对象执行依赖性检查
	 *bean实例中的引用（不适用于自动连接构造函数，
	 *因此在那里被忽略）
	 *@return新的bean实例
	 *如果实例化或连接失败，@throws BeansException
	 *@参见#AUTOWIRE_NO
	 *@参见#AUTOWIRE_BY_NAME
	 *@参见#AUTOWIRE_BY_TYPE
	 *@参见#AUTOWIRE_CCONSTRUCTOR
	 *@参见#AUTOWIRE_AUTODETECT
	 *@参见#initializeBean
	 *@参见#applyBeanPostProcessorBeforeInitialization
	 *@参见#applyBeanPostProcessorAfterInitialization
	 */
	Object autowire(Class<?> beanClass, int autowireMode, boolean dependencyCheck) throws BeansException;

	/**
	 * Autowire the bean properties of the given bean instance by name or type.
	 * Can also be invoked with {@code AUTOWIRE_NO} in order to just apply
	 * after-instantiation callbacks (e.g. for annotation-driven injection).
	 * <p>Does <i>not</i> apply standard {@link BeanPostProcessor BeanPostProcessors}
	 * callbacks or perform any further initialization of the bean. This interface
	 * offers distinct, fine-grained operations for those purposes, for example
	 * {@link #initializeBean}. However, {@link InstantiationAwareBeanPostProcessor}
	 * callbacks are applied, if applicable to the configuration of the instance.
	 * @param existingBean the existing bean instance
	 * @param autowireMode by name or type, using the constants in this interface
	 * @param dependencyCheck whether to perform a dependency check for object
	 * references in the bean instance
	 * @throws BeansException if wiring failed
	 * @see #AUTOWIRE_BY_NAME
	 * @see #AUTOWIRE_BY_TYPE
	 * @see #AUTOWIRE_NO
	 */
	/**
	 *按名称或类型自动连接给定bean实例的bean财产。
	 *也可以使用｛@code AUTOWIRE_NO｝调用，以便仅应用
	 *在实例化回调之后（例如用于注释驱动的注入）。
	 *＜p＞＜i＞是否＜/i＞应用标准｛@link BeanPostProcessor BeanPostProcessors｝
	 *回调或执行bean的任何进一步初始化。此接口
	 *例如，为这些目的提供了不同的细粒度操作
	 *｛@link#initializeBean｝。然而，｛@link InstantiationAwareBeanPostProcessor｝
	 *如果适用于实例的配置，则应用回调。
	 *@param existingBean现有bean实例
	 *@param autowireMode（按名称或类型），使用此接口中的常量
	 *@param dependencyCheck是否对对象执行依赖性检查
	 *bean实例中的引用
	 *如果连线失败，@throws BeansException
	 *@参见#AUTOWIRE_BY_NAME
	 *@参见#AUTOWIRE_BY_TYPE
	 *@参见#AUTOWIRE_NO
	 */
	void autowireBeanProperties(Object existingBean, int autowireMode, boolean dependencyCheck)
			throws BeansException;

	/**
	 * Apply the property values of the bean definition with the given name to
	 * the given bean instance. The bean definition can either define a fully
	 * self-contained bean, reusing its property values, or just property values
	 * meant to be used for existing bean instances.
	 * <p>This method does <i>not</i> autowire bean properties; it just applies
	 * explicitly defined property values. Use the {@link #autowireBeanProperties}
	 * method to autowire an existing bean instance.
	 * <b>Note: This method requires a bean definition for the given name!</b>
	 * <p>Does <i>not</i> apply standard {@link BeanPostProcessor BeanPostProcessors}
	 * callbacks or perform any further initialization of the bean. This interface
	 * offers distinct, fine-grained operations for those purposes, for example
	 * {@link #initializeBean}. However, {@link InstantiationAwareBeanPostProcessor}
	 * callbacks are applied, if applicable to the configuration of the instance.
	 * @param existingBean the existing bean instance
	 * @param beanName the name of the bean definition in the bean factory
	 * (a bean definition of that name has to be available)
	 * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException
	 * if there is no bean definition with the given name
	 * @throws BeansException if applying the property values failed
	 * @see #autowireBeanProperties
	 */
	/**
	 *将具有给定名称的bean定义的属性值应用于
	 *给定的bean实例。bean定义可以完全定义
	 *自包含bean，重用其属性值，或仅使用属性值
	 *用于现有bean实例。
	 *<p>此方法不具有autowire bean财产；它正好适用
	 *显式定义的属性值。使用｛@link#autowireBeanProperties｝
	 *方法自动连接现有bean实例。
	 *<b>注意：此方法需要给定名称的bean定义</b>
	 *＜p＞＜i＞是否＜/i＞应用标准｛@link BeanPostProcessor BeanPostProcessors｝
	 *回调或执行bean的任何进一步初始化。此接口
	 *例如，为这些目的提供了不同的细粒度操作
	 *｛@link#initializeBean｝。然而，｛@link InstantiationAwareBeanPostProcessor｝
	 *如果适用于实例的配置，则应用回调。
	 *@param existingBean现有bean实例
	 *@param beanName bean工厂中bean定义的名称
	 *（该名称的bean定义必须可用）
	 *@throws org.springframework.beans.factory.NoSuchBeanDefinitionException
	 *如果没有具有给定名称的bean定义
	 *如果应用属性值失败，@throws BeansException
	 *@参见#autowireBeanProperties
	 */
	void applyBeanPropertyValues(Object existingBean, String beanName) throws BeansException;

	/**
	 * Initialize the given raw bean, applying factory callbacks
	 * such as {@code setBeanName} and {@code setBeanFactory},
	 * also applying all bean post processors (including ones which
	 * might wrap the given raw bean).
	 * <p>Note that no bean definition of the given name has to exist
	 * in the bean factory. The passed-in bean name will simply be used
	 * for callbacks but not checked against the registered bean definitions.
	 * @param existingBean the existing bean instance
	 * @param beanName the name of the bean, to be passed to it if necessary
	 * (only passed to {@link BeanPostProcessor BeanPostProcessors};
	 * can follow the {@link #ORIGINAL_INSTANCE_SUFFIX} convention in order to
	 * enforce the given instance to be returned, i.e. no proxies etc)
	 * @return the bean instance to use, either the original or a wrapped one
	 * @throws BeansException if the initialization failed
	 * @see #ORIGINAL_INSTANCE_SUFFIX
	 */
	/**
	 *初始化给定的原始bean，应用工厂回调
	 *例如｛@code setBeanName｝和｛@codesetBeanFactory｝，
	 *还应用所有bean后处理器（包括
	 *可以包裹给定的生豆）。
	 *＜p＞注意，不必存在给定名称的bean定义
	 *在豆制品厂。只需使用传入的bean名称
	 *用于回调，但未根据注册的bean定义进行检查。
	 *@param existingBean现有bean实例
	 *@param beanName bean的名称，如果需要，将传递给它
	 *（仅传递给｛@link BeanPostProcessor BeanPostProcessors｝；
	 *可以遵循｛@link#ORIGINAL_INSTANCE_SUFFIX｝约定，以便
	 *强制返回给定实例，即无代理等）
	 *@返回要使用的bean实例，无论是原始实例还是包装的实例
	 *如果初始化失败，@throws BeansException
	 *@参见#ORIGINAL_INSTANCE_SUFFIX
	 */
	Object initializeBean(Object existingBean, String beanName) throws BeansException;

	/**
	 * Apply {@link BeanPostProcessor BeanPostProcessors} to the given existing bean
	 * instance, invoking their {@code postProcessBeforeInitialization} methods.
	 * The returned bean instance may be a wrapper around the original.
	 * @param existingBean the existing bean instance
	 * @param beanName the name of the bean, to be passed to it if necessary
	 * (only passed to {@link BeanPostProcessor BeanPostProcessors};
	 * can follow the {@link #ORIGINAL_INSTANCE_SUFFIX} convention in order to
	 * enforce the given instance to be returned, i.e. no proxies etc)
	 * @return the bean instance to use, either the original or a wrapped one
	 * @throws BeansException if any post-processing failed
	 * @see BeanPostProcessor#postProcessBeforeInitialization
	 * @see #ORIGINAL_INSTANCE_SUFFIX
	 */
	/**
	 *将｛@link BeanPostProcessor BeanPostProcessors｝应用于给定的现有bean
	 *实例，调用其｛@code postProcessBeforeInitialization｝方法。
	 *返回的bean实例可能是原始bean的包装器。
	 *@param existingBean现有bean实例
	 *@param beanName bean的名称，如果需要，将传递给它
	 *（仅传递给｛@link BeanPostProcessor BeanPostProcessors｝；
	 *可以遵循｛@link#ORIGINAL_INSTANCE_SUFFIX｝约定，以便
	 *强制返回给定实例，即无代理等）
	 *@返回要使用的bean实例，无论是原始实例还是包装的实例
	 *如果任何后处理失败，@throws BeansException
	 *@参见BeanPostProcessor#postProcessBeforeInitialization
	 *@参见#ORIGINAL_INSTANCE_SUFFIX
	 */
	Object applyBeanPostProcessorsBeforeInitialization(Object existingBean, String beanName)
			throws BeansException;

	/**
	 * Apply {@link BeanPostProcessor BeanPostProcessors} to the given existing bean
	 * instance, invoking their {@code postProcessAfterInitialization} methods.
	 * The returned bean instance may be a wrapper around the original.
	 * @param existingBean the existing bean instance
	 * @param beanName the name of the bean, to be passed to it if necessary
	 * (only passed to {@link BeanPostProcessor BeanPostProcessors};
	 * can follow the {@link #ORIGINAL_INSTANCE_SUFFIX} convention in order to
	 * enforce the given instance to be returned, i.e. no proxies etc)
	 * @return the bean instance to use, either the original or a wrapped one
	 * @throws BeansException if any post-processing failed
	 * @see BeanPostProcessor#postProcessAfterInitialization
	 * @see #ORIGINAL_INSTANCE_SUFFIX
	 */
	/**
	 *将｛@link BeanPostProcessor BeanPostProcessors｝应用于给定的现有bean
	 *实例，调用其｛@code postProcessAfterInitialization｝方法。
	 *返回的bean实例可能是原始bean的包装器。
	 *@param existingBean现有bean实例
	 *@param beanName bean的名称，如果需要，将传递给它
	 *（仅传递给｛@link BeanPostProcessor BeanPostProcessors｝；
	 *可以遵循｛@link#ORIGINAL_INSTANCE_SUFFIX｝约定，以便
	 *强制返回给定实例，即无代理等）
	 *@返回要使用的bean实例，无论是原始实例还是包装的实例
	 *如果任何后处理失败，@throws BeansException
	 *@参见BeanPostProcessor#postProcessAfterInitialization
	 *@参见#ORIGINAL_INSTANCE_SUFFIX
	 */
	Object applyBeanPostProcessorsAfterInitialization(Object existingBean, String beanName)
			throws BeansException;

	/**
	 * Destroy the given bean instance (typically coming from {@link #createBean}),
	 * applying the {@link org.springframework.beans.factory.DisposableBean} contract as well as
	 * registered {@link DestructionAwareBeanPostProcessor DestructionAwareBeanPostProcessors}.
	 * <p>Any exception that arises during destruction should be caught
	 * and logged instead of propagated to the caller of this method.
	 * @param existingBean the bean instance to destroy
	 */
	/**
	 *销毁给定的bean实例（通常来自｛@link#createBean｝），
	 *应用{@link.org.springframework.beans.factory.DisposableBean}合同以及
	 *已注册｛@link DestructionAwareBeanPostProcessor DestructionAware BeanPostProcessors｝。
	 *＜p＞销毁过程中出现的任何异常都应被捕获
	 *并记录而不是传播到此方法的调用方。
	 *@param existingBean要销毁的bean实例
	 */
	void destroyBean(Object existingBean);


	//-------------------------------------------------------------------------
	// -------------------------------------------------------------------------
	// Delegate methods for resolving injection points
	// 解析注入点的委托方法
	//-------------------------------------------------------------------------
	// -------------------------------------------------------------------------

	/**
	 * Resolve the bean instance that uniquely matches the given object type, if any,
	 * including its bean name.
	 * <p>This is effectively a variant of {@link #getBean(Class)} which preserves the
	 * bean name of the matching instance.
	 * @param requiredType type the bean must match; can be an interface or superclass
	 * @return the bean name plus bean instance
	 * @throws NoSuchBeanDefinitionException if no matching bean was found
	 * @throws NoUniqueBeanDefinitionException if more than one matching bean was found
	 * @throws BeansException if the bean could not be created
	 * @since 4.3.3
	 * @see #getBean(Class)
	 */
	/**
	 *解析唯一匹配给定对象类型的bean实例（如果有），
	 *包括其bean名称。
	 *＜p＞这实际上是｛@link#getBean（Class）｝的变体
	 *匹配实例的bean名称。
	 *@param requiredType bean必须匹配的类型；可以是接口或超类
	 *@return bean名称加上bean实例
	 *如果找不到匹配的bean，@throws NoSuchBeanDefinitionException
	 *如果找到多个匹配的bean，@throws NoUniqueBeanDefinitionException
	 *如果无法创建bean，@throws BeansException
	 *@自4.3.3
	 *@参见#getBean（类）
	 */
	<T> NamedBeanHolder<T> resolveNamedBean(Class<T> requiredType) throws BeansException;

	/**
	 * Resolve a bean instance for the given bean name, providing a dependency descriptor
	 * for exposure to target factory methods.
	 * <p>This is effectively a variant of {@link #getBean(String, Class)} which supports
	 * factory methods with an {@link org.springframework.beans.factory.InjectionPoint}
	 * argument.
	 * @param name the name of the bean to look up
	 * @param descriptor the dependency descriptor for the requesting injection point
	 * @return the corresponding bean instance
	 * @throws NoSuchBeanDefinitionException if there is no bean with the specified name
	 * @throws BeansException if the bean could not be created
	 * @since 5.1.5
	 * @see #getBean(String, Class)
	 */
	/**
	 *解析给定bean名称的bean实例，提供依赖描述符
	 *暴露于目标工厂方法。
	 *＜p＞这实际上是｛@link#getBean（String，Class）｝的变体，它支持
	 *带有｛@linkorg.springframework.beans.factory.InjectionPoint｝的工厂方法
	 *参数。
	 *@param name要查找的bean的名称
	 *@param descriptor请求注入点的依赖描述符
	 *@return对应的bean实例
	 *如果没有具有指定名称的bean，@throws NoSuchBeanDefinitionException
	 *如果无法创建bean，@throws BeansException
	 *@自5.1.5
	 *@see#getBean（字符串，类）
	 */
	Object resolveBeanByName(String name, DependencyDescriptor descriptor) throws BeansException;

	/**
	 * Resolve the specified dependency against the beans defined in this factory.
	 * @param descriptor the descriptor for the dependency (field/method/constructor)
	 * @param requestingBeanName the name of the bean which declares the given dependency
	 * @return the resolved object, or {@code null} if none found
	 * @throws NoSuchBeanDefinitionException if no matching bean was found
	 * @throws NoUniqueBeanDefinitionException if more than one matching bean was found
	 * @throws BeansException if dependency resolution failed for any other reason
	 * @since 2.5
	 * @see #resolveDependency(DependencyDescriptor, String, Set, TypeConverter)
	 */
	/**
	 *解决此工厂中定义的bean的指定依赖关系。
	 *@param descriptor依赖项的描述符（字段/方法/构造函数）
	 *@param requestingBeanName声明给定依赖项的bean的名称
	 *@返回解析的对象，如果未找到，则返回｛@code null｝
	 *如果找不到匹配的bean，@throws NoSuchBeanDefinitionException
	 *如果找到多个匹配的bean，@throws NoUniqueBeanDefinitionException
	 *如果依赖项解析因任何其他原因失败，@throws BeansException
	 *@自2.5
	 *@see#resolveDependency（DependencyDescriptor、String、Set、TypeConverter）
	 */
	@Nullable
	Object resolveDependency(DependencyDescriptor descriptor, @Nullable String requestingBeanName) throws BeansException;

	/**
	 * Resolve the specified dependency against the beans defined in this factory.
	 * @param descriptor the descriptor for the dependency (field/method/constructor)
	 * @param requestingBeanName the name of the bean which declares the given dependency
	 * @param autowiredBeanNames a Set that all names of autowired beans (used for
	 * resolving the given dependency) are supposed to be added to
	 * @param typeConverter the TypeConverter to use for populating arrays and collections
	 * @return the resolved object, or {@code null} if none found
	 * @throws NoSuchBeanDefinitionException if no matching bean was found
	 * @throws NoUniqueBeanDefinitionException if more than one matching bean was found
	 * @throws BeansException if dependency resolution failed for any other reason
	 * @since 2.5
	 * @see DependencyDescriptor
	 */
	/**
	 *解决此工厂中定义的bean的指定依赖关系。
	 *@param descriptor依赖项的描述符（字段/方法/构造函数）
	 *@param requestingBeanName声明给定依赖项的bean的名称
	 *@param autowiredBeanNames设置所有自动连线bean的名称（用于
	 *解析给定的依赖关系）
	 *@param typeConverter用于填充数组和集合的typeConverter
	 *@返回解析的对象，如果未找到，则返回｛@code null｝
	 *如果找不到匹配的bean，@throws NoSuchBeanDefinitionException
	 *如果找到多个匹配的bean，@throws NoUniqueBeanDefinitionException
	 *如果依赖项解析因任何其他原因失败，@throws BeansException
	 *@自2.5
	 *@参见DependencyDescriptor
	 */
	@Nullable
	Object resolveDependency(DependencyDescriptor descriptor, @Nullable String requestingBeanName,
			@Nullable Set<String> autowiredBeanNames, @Nullable TypeConverter typeConverter) throws BeansException;

}
